<script type="text/javascript">
    var popupWidth = eval('<?php echo isset($popupWidth) ? $popupWidth : ''; ?>');
    var popupHeight= eval('<?php echo isset($popupHeight) ? $popupHeight : ''; ?>');
    var popupPosition = eval('<?php echo isset($popupPosition) ? $popupPosition : ''; ?>');
    $j(function() {
        $j("#popup").show();
        $j("#popup").dialog($j.extend({
            width: popupWidth,
            height: popupHeight,
            position: popupPosition,
            title: "Search Criteria",
            buttons: { "Seacrh": function() {
                    $j('#submit').click();
                    $j(this).dialog("close");
                }
            },
            close: function() {
                // ทำลาย div popup ทิ้ง เผื่อการเรียก popup ครั้งต่อไป
                $j(this).dialog('destroy');
                $j(this).remove();
            }
        }, dialog_options));
    });
</script>
<div id="popup" style="display: none;">
    <?php if ($showCaption == true) : ?>
        <span class="caption">You can type a part of words</span>
    <?php endif; ?>
    <?php echo $ajax->form(null, 'post', array('update' => isset($update) ? $update : 'content', 'indicator' => 'indicator',
        'url' => array('action' => isset($action) ? $action : 'display', isset($params)? $params: null))); ?>
    <?php echo $content_for_layout; ?>
    <?php echo $form->submit('Search', array('id' => 'submit', 'class' => 'hide')); ?>
    <?php echo $form->end(); ?>
</div>